#ifndef _RTC_RX8010_H_
#define _RTC_RX8010_H_
#include "fsl_common.h"


#define EXAMPLE_DELAY_COUNT 8000000

///////////RX8010///////////
#define RX8010_Address 0x32
#define RX8010_SEC     0x10
#define RX8010_MIN     0x11
#define RX8010_HOUR    0x12
#define RX8010_WDAY    0x13
#define RX8010_MDAY    0x14
#define RX8010_MONTH   0x15
#define RX8010_YEAR    0x16
#define RX8010_YEAR    0x16
#define RX8010_RESV17  0x17
#define RX8010_ALMIN   0x18
#define RX8010_ALHOUR  0x19
#define RX8010_ALWDAY  0x1A
#define RX8010_TCOUNT0 0x1B
#define RX8010_TCOUNT1 0x1C
#define RX8010_EXT     0x1D
#define RX8010_FLAG    0x1E
#define RX8010_CTRL    0x1F
/* 0x20 to 0x2F are user registers */
#define RX8010_RESV30  0x30
#define RX8010_RESV31  0x31
#define RX8010_IRQ     0x32

#define RX8010_EXT_WADA  0x04//BIT(3)

#define RX8010_FLAG_VLF  0x02//BIT(1)
#define RX8010_FLAG_AF   0x04//BIT(3)
#define RX8010_FLAG_TF   0x08//BIT(4)
#define RX8010_FLAG_UF   0x10//BIT(5)

#define RX8010_CTRL_AIE  0x04//BIT(3)
#define RX8010_CTRL_UIE  0x10//BIT(5)
#define RX8010_CTRL_STOP 0x20//BIT(6)
#define RX8010_CTRL_TEST 0x40//BIT(7)

#define RX8010_ALARM_AE  0x40//BIT(7)



int rx8010_init();
int rx8010_get_time(uint8_t year_h,uint8_t year_l,uint8_t month_h,
					uint8_t month_l,uint8_t day_h,uint8_t day_l,
					uint8_t hour_h,uint8_t hour_l,uint8_t minutes_h,
					uint8_t minutes_l,uint8_t sec_h,uint8_t sec_l);
int rx8010_set_time(uint8_t *asc_date);
#endif
